package com.frank.big.mapper;

import com.frank.big.dto.BidataRequestDTO;
import com.frank.big.model.BidataRequest;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author 小石潭记
 * @date 2020/10/26 15:17
 * @Description: ${todo}
 */
@Mapper
public interface EnterpriseRequestMapper {

    EnterpriseRequestMapper MAPPER = Mappers.getMapper(EnterpriseRequestMapper.class);

    /**
     *
     * @param source 将该系统完整的参数对象转为中数接口需要的对象（目标对象）
     * @return 返回中数接口的对象
     *                          只需要将属性名称不一样的罗列对应起来，名称一样的不需要定义出来
     */
    @Mappings({
            @Mapping(source = "creditCode", target = "creditcode"),
            @Mapping(source = "enterpriseType", target = "enttype"),
            @Mapping(source = "enterpriseStatus", target = "entstatus"),
            @Mapping(source = "organizationCode", target = "orgcode"),
            @Mapping(source = "registrationNo", target = "regno"),
            @Mapping(source = "enterpriseName", target = "name"),
            @Mapping(source = "enterpriseId", target = "id")
    })
    BidataRequestDTO toTarget(BidataRequest source);

}
